Optimal. Leaf size=92 \[ -\frac {a^2 \log (\cos (c+d x))}{d}-\frac {a (a+b) \log (1-\sec (c+d x))}{2 d}-\frac {a (a-b) \log (1+\sec (c+d x))}{2 d}-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3970, 1819,
815} \begin {gather*} -\frac {\cot ^2(c+d x) \left (a^2+2 a b \sec (c+d x)+b^2\right )}{2 d}-\frac {a^2 \log (\cos (c+d x))}{d}-\frac {a (a+b) \log (1-\sec (c+d x))}{2 d}-\frac {a (a-b) \log (\sec (c+d x)+1)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 815
Rule 1819
Rule 3970
Rubi steps
\begin {align*} \int \cot ^3(c+d x) (a+b \sec (c+d x))^2 \, dx &=\frac {b^4 \text {Subst}\left (\int \frac {(a+x)^2}{x \left (b^2-x^2\right )^2} \, dx,x,b \sec (c+d x)\right )}{d}\\ &=-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d}-\frac {b^2 \text {Subst}\left (\int \frac {-2 a^2-2 a x}{x \left (b^2-x^2\right )} \, dx,x,b \sec (c+d x)\right )}{2 d}\\ &=-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d}-\frac {b^2 \text {Subst}\left (\int \left (-\frac {a (a+b)}{b^2 (b-x)}-\frac {2 a^2}{b^2 x}+\frac {a (a-b)}{b^2 (b+x)}\right ) \, dx,x,b \sec (c+d x)\right )}{2 d}\\ &=-\frac {a^2 \log (\cos (c+d x))}{d}-\frac {a (a+b) \log (1-\sec (c+d x))}{2 d}-\frac {a (a-b) \log (1+\sec (c+d x))}{2 d}-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.49, size = 82, normalized size = 0.89 \begin {gather*} -\frac {(a+b)^2 \csc ^2\left (\frac {1}{2} (c+d x)\right )+8 a \left ((a-b) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+(a+b) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+(a-b)^2 \sec ^2\left (\frac {1}{2} (c+d x)\right )}{8 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 92, normalized size = 1.00
method | result | size |
derivativedivides | \(\frac {-\frac {b^{2}}{2 \sin \left (d x +c \right )^{2}}+2 b a \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )}{d}\) | \(92\) |
default | \(\frac {-\frac {b^{2}}{2 \sin \left (d x +c \right )^{2}}+2 b a \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )}{d}\) | \(92\) |
risch | \(i a^{2} x +\frac {2 i a^{2} c}{d}+\frac {2 b a \,{\mathrm e}^{3 i \left (d x +c \right )}+2 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+2 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+2 b a \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b a}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b a}{d}\) | \(165\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 72, normalized size = 0.78 \begin {gather*} -\frac {{\left (a^{2} - a b\right )} \log \left (\cos \left (d x + c\right ) + 1\right ) + {\left (a^{2} + a b\right )} \log \left (\cos \left (d x + c\right ) - 1\right ) - \frac {2 \, a b \cos \left (d x + c\right ) + a^{2} + b^{2}}{\cos \left (d x + c\right )^{2} - 1}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.31, size = 113, normalized size = 1.23 \begin {gather*} \frac {2 \, a b \cos \left (d x + c\right ) + a^{2} + b^{2} - {\left ({\left (a^{2} - a b\right )} \cos \left (d x + c\right )^{2} - a^{2} + a b\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - {\left ({\left (a^{2} + a b\right )} \cos \left (d x + c\right )^{2} - a^{2} - a b\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \cot ^{3}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 209 vs.
\(2 (86) = 172\).
time = 0.52, size = 209, normalized size = 2.27 \begin {gather*} \frac {8 \, a^{2} \log \left ({\left | -\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1 \right |}\right ) + \frac {a^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {2 \, a b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {b^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - 4 \, {\left (a^{2} + a b\right )} \log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right ) + \frac {{\left (a^{2} + 2 \, a b + b^{2} + \frac {4 \, a^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {4 \, a b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}{\cos \left (d x + c\right ) - 1}}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.36, size = 98, normalized size = 1.07 \begin {gather*} \frac {a^2\,\ln \left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}{d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,{\left (a-b\right )}^2}{8\,d}-\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (a^2+b\,a\right )}{d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {a^2}{8}+\frac {a\,b}{4}+\frac {b^2}{8}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________